// pages/gk_examInfo/gk_examInfo.js
Page({
  data: {
    // 定义页面映射对象
    pageMap: {
      grid1: '/pages/gaokao/gk_exam_registrationInfo/gk_exam_registrationInfo',
      grid2: '/pages/gaokao/gk_info_pages/gk_country/gk_country',
      grid3: '/pages/gaokao/gk_info_pages/gk_city/gk_city',
      grid4: '/pages/gaokao/gk_info_pages/gk_foreign_oral/gk_foreign_oral',
      grid5: '/pages/gaokao/gk_info_pages/gk_exam_type/gk_exam_type',
      grid6: '/pages/gaokao/gk_info_pages/gk_apply_type/gk_apply_type',
      grid7: '/pages/gaokao/gk_info_pages/gk_candidate_type/gk_candidate_type',
      grid8: '/pages/gaokao/gk_info_pages/gk_middle_school/gk_middle_school',
      grid9: '/pages/gaokao/gk_info_pages/gk_foreign_language/gk_foreign_language',
      grid10: '/pages/gaokao/gk_info_pages/gk_registration_authority/gk_registration_authority',
      grid11: '/pages/gaokao/gk_info_pages/gk_registered_residence/gk_registered_residence',
      grid12: '/pages/gaokao/gk_info_pages/gk_graduate_type/gk_graduate_type'
    },
    bannerList: [
      { src: "/icon/huiyi2.jpg" },
      { src: "/icon/test2.jpg" },
      { src: "/icon/test3.jpg" }
    ],
    // 其他数据按需加载
  },

  // 跳转函数
  // 统一跳转函数，根据 data-type 获取跳转路径
  gotoPage(e) {
    const type = e.currentTarget.dataset.type;
    const url = this.data.pageMap[type];
    if (url) {
      console.log("page url :",url)
      wx.navigateTo({
        url: url,
        success: res => console.log('跳转成功:', url),
        fail: err => console.error('跳转失败:', err,url)
      });
    } else {
      console.error('未找到对应的页面路径，type:', type);
    }
},
});
